<template>
	<view class="brand-item" @click="toInfo">
		<image :src="props.brand.icon" mode="aspectFit"></image>
		<up-text align="center" color="#C5C5C5" lineHeight="22" size="12" :text="props.brand.name" margin="8px 0 0 0"></up-text>
	</view>
</template>

<script setup>
	const props = defineProps({
		brand: {
			type: Object,
			default: () => ({})
		}
	})
	const toInfo = () => {
		uni.$u.sleep(300).then(() => {
			uni.navigateTo({
				url: '/subPackages/brand/info'
			})
		})
	}
</script>

<style scoped lang="scss">
	.brand-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		background: #F8F8F8;
		border: 1px solid #F8F8F8;
		padding: 12px;

		image {
			width: 100%;
			height: 60px;
		}

		&:active {
			animation: shake 0.3s;
			animation-iteration-count: 1;
		}

		@keyframes shake {
			0% {
				transform: translate(1px, 1px) rotate(0deg);
			}

			10% {
				transform: translate(-1px, -2px) rotate(-1deg);
			}

			20% {
				transform: translate(-3px, 0px) rotate(1deg);
			}

			30% {
				transform: translate(3px, 2px) rotate(0deg);
			}

			40% {
				transform: translate(1px, -1px) rotate(1deg);
			}

			50% {
				transform: translate(-1px, 2px) rotate(-1deg);
			}

			60% {
				transform: translate(-3px, 1px) rotate(0deg);
			}

			70% {
				transform: translate(3px, 1px) rotate(-1deg);
			}

			80% {
				transform: translate(-1px, -1px) rotate(1deg);
			}

			90% {
				transform: translate(1px, 2px) rotate(0deg);
			}

			100% {
				transform: translate(1px, -2px) rotate(-1deg);
			}
		}

	}
</style>